package com.peppa.provider;

import com.peppa.framwork.Protocol;
import com.peppa.framwork.ProtocolFactory;
import com.peppa.framwork.URL;

import com.peppa.framwork.register.LocalRegister;
import com.peppa.framwork.register.RemoteMapRegister;
import com.peppa.provider.api.HelloService;
import com.peppa.provider.impl.HelloServiceImpl;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class Provider {

    public static void main(String[] args) {
        // 1. 注册服务
        // 2. 本地注册
        // 3. 启动tomcat/Netty

        // 注册服务
        URL url = new URL("localhost", 8080); //NetUtil
        RemoteMapRegister.regist(HelloService.class.getName(), url);

        //  服务：实现类
        LocalRegister.regist(HelloService.class.getName(), HelloServiceImpl.class);


        Protocol protocol = ProtocolFactory.getProtocol();
        protocol.start(url);


    }


}
